package com.thz.friend.service.registration.impl;

import com.thz.common.core.constants.Constants;
import com.thz.common.core.utlis.ThreadLocalUtil;
import com.thz.friend.mapper.registration.CourseRegistrationMapper;
import com.thz.friend.pojo.course.Course;
import com.thz.friend.pojo.course.vo.CourseVO;
import com.thz.friend.pojo.registration.CourseRegistration;
import com.thz.friend.service.registration.ICourseRegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description
 * @Author thz
 * @Date 2025/5/10
 */
@Service
public class CourseRegistrationServiceImpl implements ICourseRegistrationService {

    @Autowired
    private CourseRegistrationMapper courseRegistrationMapper;

    @Override
    public int add(Long courseId) {
        CourseRegistration courseRegistration = new CourseRegistration();
        courseRegistration.setCourseId(courseId);
        courseRegistration.setStudentId(ThreadLocalUtil.get(Constants.USER_ID, Long.class));
        return courseRegistrationMapper.insert(courseRegistration);
    }

}
